package org.seefly.iprint.utils;

import java.io.File;

import org.apache.pdfbox.pdmodel.PDDocument;

public class PDFUtils {

    /**
     * 
     * @Description (获取PDF文档总页数)
     * @param url
     * @return
     */
    public static String getPDFPageCount(String url) {
        File pdfFile = new File(url);
        String pageCount = null;
        PDDocument document = null;
        try {
            document = PDDocument.load(pdfFile);
            pageCount = String.valueOf(document.getNumberOfPages());
            document.close();
        } catch (Exception e) {
            System.out.println(e);
        }
        return pageCount;
    }
}
